OPTS =
CC=gcc
CXX=g++
CFLAGS=-Wall $(DEBUG) $(DEFINITIONS) $(CINCLUDES) $(CMISCFLAGS) $(LIBDIRS) $(OPTS)
CPPFLAGS=-Wall  $(DEBUG) $(EXCEPTIONS) \
	$(CPPINCLUDES) $(DEFINITIONS) $(CPPMISCFLAGS) $(LIBDIRS) $(OPTS)
DEBUG=-O3 -g3
CMISCFLAGS=
CPPMISCFLAGS=
DEFINITIONS=-DLINUX_OS -D_GNU_SOURCE -DOS_LINUX
EXCEPTIONS=-fexceptions -ffast-math

CINCLUDES=-I. -I../../../utils $(BBDT_INCLUDE) -I$(GDIR)glutImageGUI \
					-I$(GIMDIR)/JPEGEncoder -I$(GIMDIR)/glutgui
CPPINCLUDES=-I. -I../../../utils $(BBDT_INCLUDE) -I$(GDIR)glutImageGUI \
					-I$(GIMDIR)/JPEGEncoder -I$(GIMDIR)/glutgui
LIBDIRS=

LD=g++
LDFLAGS=$(LIBDIRS)
LIBS=-lrt -lpthread -lGL -lGLU -lglut -ljpeg

SRCSC=
SRCSCPP=$(BBDT_SRC_CPP) $(GIMDIR)/glutImageGUI/glutImageGUI.cpp  $(GIMDIR)/ImageUtils/JPEGEncoder/JPEGEncoder.cpp
VPATH=

LNMDIR = ..
GDIR=../../../
GIMDIR=../../..

include Makefile.mk
include $(LNMDIR)/BetB_dt/Makefile.bbdt

## Construct final lists of CPP and C objects
OBJSC=$(SRCSC:.c=.o)
OBJSCPP=$(SRCSCPP:.cpp=.opp)

## Define compiles and links
COMPILEC=$(CC) $(CFLAGS) $(CINCLUDES) -c
COMPILECPP=$(CXX) $(CPPFLAGS) $(CPPINCLUDES) -c
LINK=$(LD) $(LDFLAGS) 

.PHONY: all clean

TARGETS = matcher HoughAngleTest
all: $(TARGETS)

matcher: $(OBJSC) $(OBJSCPP) main.opp
	$(LINK) -o $@ $(OBJSC) $(OBJSCPP) main.opp $(LIBS)

HoughAngleTest: $(OBJSC) $(OBJSCPP) HoughAngleTest.opp HoughAngleMatcher.opp
	$(LINK) -o $@ $(OBJSC) $(OBJSCPP) HoughAngleTest.opp HoughAngleMatcher.opp $(LIBS)

clean:
	rm -f $(OBJSC) $(OBJSCPP) $(TARGETS) *.out *~ *.d *.dpp *.opp *.o

##manual:
##	doxygen

## Compile rule for all .o (.c) file
%.o:    %.c
				$(COMPILEC) -o $@ $<

## Compile rule for all .opp (.cpp) files
%.opp:	%.cpp
				$(COMPILECPP) -o $@ $<
